package com.view;

import java.awt.Color;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.SystemColor;
import java.awt.Toolkit;
import java.io.File;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.view.commonView.IconSrc;
import com.view.commonView.ImagePanel;

/**
 * @author Diego Iacono
 *
 */
public class InitScreen extends JFrame
{

   private static final long serialVersionUID = 1L;
   private JPanel jContentPane = null;
   private ImagePanel imagePanel = null;
   private JLabel lblCopyRight = null;
   private JLabel lblAutor = null;
   private JLabel lblSeparator = null;
   private JLabel lblRightReserved = null;
   private JLabel lblSeAutoriza = null;
   private JLabel lblSeparator2 = null;
   private JLabel lblVersion = null;
   /**
    * This is the default constructor
    */
   public InitScreen()
   {
      super();
      initialize();
   }

   /**
    * This method initializes this
    * 
    * @return void
    */
   private void initialize()
   {
      this.setSize(380, 431);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      this.setResizable(false);
      this.setContentPane(getJContentPane());
      this.setUndecorated(true);
      this.setIconImage(Toolkit.getDefaultToolkit().getImage(
         getPath() + IconSrc.WINDOW_MENU_ICON));
      centerContainer();
      lblCopyRight.setText(IconSrc.COPYRIGHT_LABEL);
      lblAutor.setText(IconSrc.COPYRIGHT_AUTHOR);
      lblRightReserved.setText(IconSrc.COPYRIGHT_RIGHT_RESERVED);
      lblSeAutoriza.setText(IconSrc.COPYRIGHT_SEAUTORIZA + IconSrc.COPYRIGHT_AUTORIZADO);
      lblVersion.setText(IconSrc.COPYRIGHT_VERSION);
   }
   
   /**
    * retrive the local App Path
    */
    private String getPath()
      {
         File currentDir = new File("");
         String pathStr = currentDir.getAbsolutePath() + "\\icon\\";
         return pathStr;
      }
   
   /**
    * This method places the view on center Screen
    */
    private void centerContainer() 
       {  
         java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();  
         int componentWidth = this.getWidth();  
         int componentHeight = this.getHeight();  
         this.setBounds((screenSize.width-componentWidth)/2, (screenSize.height-componentHeight)/2, componentWidth,     componentHeight);  
       } 

   /**
    * This method initializes jContentPane
    * 
    * @return javax.swing.JPanel
    */
   private JPanel getJContentPane()
   {
      if (jContentPane == null)
      {
         jContentPane = new JPanel();
         jContentPane.setLayout(null);
         jContentPane.setBorder(BorderFactory.createLineBorder(SystemColor.activeCaptionBorder, 2));
         jContentPane.setBackground(Color.white);
         jContentPane.add(getJPanel(), null);
      }
      return jContentPane;
   }

   /**
    * This method initializes jPanel	
    * 	
    * @return javax.swing.JPanel	
    */
   private ImagePanel getJPanel()
   {
      if (imagePanel == null)
      {
         lblVersion = new JLabel();
         lblVersion.setBounds(new Rectangle(259, 120, 61, 16));
         lblVersion.setFont(new Font("Arial Narrow", Font.BOLD, 8));
         lblVersion.setText("Version");
         lblSeparator2 = new JLabel();
         lblSeparator2.setBounds(new Rectangle(1, 371, 362, 16));
         lblSeparator2.setText("___________________________________________________");
         lblSeAutoriza = new JLabel();
         lblSeAutoriza.setBounds(new Rectangle(3, 386, 350, 16));
         lblSeAutoriza.setFont(new Font("MS Reference Sans Serif", Font.BOLD, 10));
         lblSeAutoriza.setText("Se Autoriza");
         lblRightReserved = new JLabel();
         lblRightReserved.setBounds(new Rectangle(183, 237, 161, 16));
         lblRightReserved.setFont(new Font("Calibri", Font.BOLD, 9));
         lblRightReserved.setText("RightReserd");
         lblSeparator = new JLabel();
         lblSeparator.setBounds(new Rectangle(183, 224, 175, 16));
         lblSeparator.setFont(new Font("Dialog", Font.BOLD, 10));
         lblSeparator.setText("____________________");
         lblAutor = new JLabel();
         lblAutor.setBounds(new Rectangle(183, 223, 124, 16));
         lblAutor.setFont(new Font("Franklin Gothic Medium", Font.BOLD, 10));
         lblAutor.setText("Author");
         lblCopyRight = new JLabel();
         lblCopyRight.setBounds(new Rectangle(183, 212, 140, 16));
         lblCopyRight.setFont(new Font("Dialog", Font.BOLD, 9));
         lblCopyRight.setText("CopyRight");
         imagePanel = new ImagePanel(IconSrc.WINDOW_BACKGROUND_INIT);
         imagePanel.setLayout(null);
         imagePanel.setBounds(new Rectangle(9, 7, 357, 404));
         imagePanel.add(lblCopyRight, null);
         imagePanel.add(lblAutor, null);
         imagePanel.add(lblSeparator, null);
         imagePanel.add(lblRightReserved, null);
         imagePanel.add(lblSeAutoriza, null);
         imagePanel.add(lblSeparator2, null);
         imagePanel.add(lblVersion, null);
      }
      return imagePanel;
   }

}  //  @jve:decl-index=0:visual-constraint="10,10"
